﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>engage_resumeTo</title>
    <script src="~/lib/axios/dist/axios.js"></script>
    <script src="~/lib/vue/dist/vue.js"></script>
    <script src="~/lib/element-ui/lib/index.js"></script>
    <link href="~/lib/element-ui/lib/theme-chalk/index.css" rel="stylesheet" />
</head>
<body>
    <div id="app">
        <el-container>
            <el-header style="height: 57px">
                <el-card class="box-card" style="height: 65px">
                    <el-form ref="form" :model="form" :rules="rules" label-width="80px" :inline="true" size="mini">
                        <el-form-item label="请选择职位分类" prop="human_major_id" label-width="121px">
                            <div class="block">
                                <el-cascader v-model="form.human_major_id"
                                             :options="listd"
                                             ref="cascaderAddr1"
                                             @@change="adminSelect1"></el-cascader>
                            </div>
                        </el-form-item>
                        <el-form-item label="请输入关键字" prop="text" label-width="107px">
                            <el-input v-model="form.text" style="width: 100px"></el-input>
                        </el-form-item>
                        <el-form-item prop="regist_time" label="请选择登记时间" label-width="110px">
                            <el-date-picker v-model="form.regist_time"
                                            type="daterange"
                                            range-separator="至"
                                            format="yyyy 年 MM 月 dd 日"
                                            value-format="yyyy-MM-dd"
                                            start-placeholder="开始日期"
                                            end-placeholder="结束日期">
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item>
                            <template>
                                <el-button type="primary" @@click="submitForm('form')">查询</el-button>
                            </template>
                        </el-form-item>
                    </el-form>
                    </el-card>
            </el-header>
            <el-main>
                <el-card class="box-card">
                    <el-table :data="list" style="width: 100%" border stripe>
                        <el-table-column prop="human_major_kind_name"
                                         label="职位分类名称"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="human_major_name"
                                         label="职位名称"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="human_name"
                                         label="姓名"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="engage_type"
                                         label="招聘类型"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="human_sex"
                                         label="性别"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="regist_time"
                                         label="登记时间"
                                         format="yyyy 年 MM 月 dd 日"
                                         value-format="yyyy-MM-dd"
                                         align="center"
                                         :formatter="dateFormat">
                        </el-table-column>
                        <el-table-column label="操作" align="center">
                            <template slot-scope="scope">
                                <el-button size="mini" type="primary" @@click="cz(scope.row)">查看</el-button>
                            </template>
                        </el-table-column>
                    </el-table>

                    <el-row>
                        <el-col :span="1">
                            <el-pagination v-on:size-change="handleSizeChange"
                                           v-on:current-change="handleCurrentChange"
                                           :current-page="queryinfo.currentPage"
                                           :page-sizes="[1, 2, 3, 4]"
                                           :page-size="queryinfo.pageSize"
                                           layout="total, sizes, prev, pager, next, jumper"
                                           :total="total">
                            </el-pagination>
                        </el-col>
                    </el-row>
                </el-card>
            </el-main>
        </el-container>
    </div>
    <script type="text/javascript">
        var vm = new Vue({
            el: "#app",
            data: {
                list: [],//简历登记
                listd: [],//职位
                queryinfo: {
                    currentPage: 1,//当前页
                    pageSize: 3//总页数
                },
                total: 1,//总条数
                form: {
                    human_major_kind_id:'',
                    human_major_kind_name: '',
                    human_major_id:'',
                    human_major_name: '',
                    regist_time:[],
                    text:''
                },
                rules: {
                    human_major_id: [
                        { required: true, message: '请选择职位', trigger: 'change' }
                    ],
                    text: [
                        { required: true, message: '请输入关键字', trigger: 'blur' },
                    ]
                },
            
            },
            methods: {
                //日期格式化
                dateFormat(row, column) {
                    // 获取单元格数据
                    let data = row[column.property]
                    if (data == null) {
                        return null
                    }
                    let dt = new Date(data)
                    return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate();
                },
                    cz(row) {
                        this.$confirm('此操作将跳转简历登记, 是否跳转?', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(() => {
                            location.href = "/engage_resumeUpdate/engage_resumeUpdate/" + row.res_id;
                        }).catch(() => {
                            this.$message({
                                type: 'info',
                                message: '已取消跳转'
                            });
                        });
                    },
                submitForm(formName) {
                    //表单验证
                        this.$refs[formName].validate((valid) => {
                            if (valid) {
                                 //简历登记表未推荐模糊查询
                                axios.get('/engage_resumeTo/Like', {
                                    params: {
                                        human_major_kind_name: this.form.human_major_kind_name,
                                        human_major_name: this.form.human_major_name,
                                        human_name: this.form.text,
                                        human_telephone: this.form.text,
                                        human_idcard: this.form.text,
                                        human_history_records: this.form.text,
                                        regist_time: this.form.regist_time[0],
                                        pass_regist_time: this.form.regist_time[1],
                                        currentPage: this.queryinfo.currentPage,
                                        pageSize: this.queryinfo.pageSize
                                    }
                                })
                                    .then(res => {
                                        console.info(res);
                                        this.list = res.data.Data;
                                        this.total = res.data.Row;
                                    })
                                    .catch(err => {
                                        console.info(err);
                                    });
                            } else {
                                this.$message({
                                    type: 'error',
                                    message: '请填写完整信息!'
                                });
                                return false;
                            }
                        });
                },
                adminSelect1(value, thsAreaCode) {
                    //获取组件名为cascaderAddr1的选中节点中的labe,pathlabes获取labe数组
                    var thsAreaCode = this.$refs.cascaderAddr1.getCheckedNodes()[0].pathLabels;
                    var forminsert = value;
                    this.form.human_major_kind_id = forminsert[0];
                    this.form.human_major_id = forminsert[1];
                    this.form.human_major_kind_name = thsAreaCode[0];
                    this.form.human_major_name = thsAreaCode[1];
                },
                fill() {
                    //简历登记表未推荐查询
                    axios.get('/engage_resumeTo/Query', {
                        params: {
                            currentPage: this.queryinfo.currentPage,
                            pageSize: this.queryinfo.pageSize
                        }
                    })
                        .then(res => {
                            console.info(res);
                            this.list = res.data.Data;
                            this.total = res.data.Row;
                        })
                        .catch(err => {
                            console.info(err);
                        });
                    //职位查询
                    axios.get('/engage_major_release/Dgto', {
                    })
                        .then(res => {
                            console.info(res);
                            this.listd = res.data;
                        })
                        .catch(err => {
                            console.info(err);
                        });
                },
                //分页总页数改变事件
                handleSizeChange(val) {
                    this.queryinfo.pageSize = val;
                    this.fill();
                },
                //分页当前页改变事件
                handleCurrentChange(val) {
                    this.queryinfo.currentPage = val;
                    this.fill();
                }
            },
            //可以对vue的数据和方法进行操作,不能对DOM进行操作
            created: function () {
                this.fill();
            }
        });
    </script>
    <style scoped>

        element.style {
            height: 100%;
            width: 1239px;
        }

        .el-button.is-circle {
            border-radius: 50%;
            padding: 12px;
            position: relative;
            top: -10px;
            right: -570px;
        }
    </style>
</body>
</html>
